package com.github.cakin.shiro.chapter23.service;

import com.github.cakin.shiro.chapter23.dao.AppDao;
import com.github.cakin.shiro.chapter23.entity.App;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className: AppServiceImpl
 * @description: App服务实现类
 * @date: 2020/6/1
 * @author: cakin
 */
@Service

public class AppServiceImpl implements AppService {
    /**
     * appDao
     */
    @Autowired
    private AppDao appDao;
    /**
     * 功能描述：创建App
     *
     * @param app app应用
     * @return App 创建的App
     * @author cakin
     * @date 2020/6/1
     * @description:
     */
    public App createApp(App app) {
        return appDao.createApp(app);
    }
    /**
     * 功能描述：更新App
     *
     * @param app app应用
     * @return App 修改后的App
     * @author cakin
     * @date 2020/6/1
     */
    public App updateApp(App app) {
        return appDao.updateApp(app);
    }
    /**
     * 功能描述：删除App
     *
     * @param appId app主键
     * @author cakin
     * @date 2020/6/1
     */
    public void deleteApp(Long appId) {
        appDao.deleteApp(appId);
    }

    /**
     * 功能描述：根据appId找到对应的App
     *
     * @param appId appId
     * @return App App
     * @author cakin
     * @date 2020/6/1
     */
    public App findOne(Long appId) {
        return appDao.findOne(appId);
    }

    /**
     * 功能描述：找到所有的App
     *
     * @return List<App> App列表
     * @author cakin
     * @date 2020/6/1
     */
    public List<App> findAll() {
        return appDao.findAll();
    }

    /**
     * 功能描述：根据appKey找到对应的主键
     *
     * @param appKey app键
     * @return List<App> App列表
     * @author cakin
     * @date 2020/6/1
     */
    public Long findAppIdByAppKey(String appKey) {
        return appDao.findAppIdByAppKey(appKey);
    }
}
